<?php
/**
 * Description: 获取课程标签
 * User: devforma
 * Date: 15/6/6
 * Time: 18:43
 */

class CourseFilterTag implements iController {

    /**
     * api请求处理主函数
     * @param array $queryArgs 就是$_REQUEST变量
     * @return array api返回结果，必须含response_code
     */
    public function output($queryArgs) {
        global $cmsdb;

        $tags = $cmsdb->getResults('SELECT `id`, `category_name` FROM `course_category`');

        $tags = empty($tags) ? array() : $tags;

        foreach ($tags as &$tag) {
            $tag->id = intval($tag->id);
        }

        array_unshift($tags, array('id' => 0, 'category_name' => '全部'));

        return genOutput(1, array(
            'list' => $tags
        ));
    }
}